package com.toxictest.testproject.core;

import static playn.core.PlayN.*;

import java.util.ArrayList;
import java.util.List;

import playn.core.GroupLayer;

public class Star extends AbstractShape {
	
	private List<Quad> shape= new ArrayList<Quad>(5);

	public Star(GroupLayer shapeLayer) {
		Quad quad1= new Quad();
		Quad quad2= new Quad();
		Quad quad3= new Quad();
		Quad quad4= new Quad();
		Quad quad5= new Quad();
		shape.add(quad1);
		shape.add(quad2);
		shape.add(quad3);
		shape.add(quad4);
		shape.add(quad5);
		layer = graphics().createGroupLayer();
		layer.setOrigin(Quad.getSIDE()*1.5f, Quad.getSIDE()*1.5f);
		layer.setTranslation(location[0],location[1]);
		layer.addAt( quad1.getImage(), 0, Quad.getSIDE() );
		layer.addAt( quad2.getImage(), Quad.getSIDE(), 0 );
		layer.addAt( quad3.getImage(), Quad.getSIDE(), Quad.getSIDE() );
		layer.addAt( quad4.getImage(), Quad.getSIDE(), Quad.getSIDE()*2f );
		layer.addAt( quad5.getImage(), Quad.getSIDE()*2f, Quad.getSIDE() );
		setHeight( Quad.getSIDE()*3f );
		setWidth( Quad.getSIDE()*3f );
		shapeLayer.add(layer);
	}

	@Override
	float[][] getBottomLine() {
		float[][] bottomLine = null;
		bottomLine = new float[6][2];
		bottomLine[0][0]=( location[0] );
		bottomLine[0][1]=( location[1] + Quad.getSIDE()*2f );
		bottomLine[1][0]=( location[0] + Quad.getSIDE()*1f );
		bottomLine[1][1]=( location[1] + Quad.getSIDE()*2f );
		bottomLine[2][0]=( location[0] + Quad.getSIDE()*1f);
		bottomLine[2][1]=( location[1] + Quad.getSIDE()*3f);
		bottomLine[3][0]=( location[0] + Quad.getSIDE()*2f );
		bottomLine[3][1]=( location[1] + Quad.getSIDE()*3f);
		bottomLine[4][0]=( location[0] + Quad.getSIDE()*2f);
		bottomLine[4][1]=( location[1] + Quad.getSIDE()*2f);
		bottomLine[5][0]=( location[0] + Quad.getSIDE()*3f );
		bottomLine[5][1]=( location[1] + Quad.getSIDE()*2f);
		return bottomLine;
	}

	@Override
	float[][] getTopLine() {
		float[][] topLine=null;
		topLine = new float[6][2];
		topLine[0][0]=( location[0] );
		topLine[0][1]=( location[1] + Quad.getSIDE()*1f );
		topLine[1][0]=( location[0] + Quad.getSIDE()*1f );
		topLine[1][1]=( location[1] + Quad.getSIDE()*1f );
		topLine[2][0]=( location[0] + Quad.getSIDE()*1f);
		topLine[2][1]=( location[1] );
		topLine[3][0]=( location[0] + Quad.getSIDE()*2f );
		topLine[3][1]=( location[1] );
		topLine[4][0]=( location[0] + Quad.getSIDE()*2f);
		topLine[4][1]=( location[1] + Quad.getSIDE()*1f);
		topLine[5][0]=( location[0] + Quad.getSIDE()*3f );
		topLine[5][1]=( location[1] + Quad.getSIDE()*1f);
		return topLine;
	}
	
	@Override
	public void rotate() {
		//shape is not rotating
	}

}
